import request from '@/api/request/index'
import type {
  CaiGouDanCaiGouDanSKUKaiPiaoPinMingDto,
  ResultPostring,
  ZhangDanQueRendto,
  KaiPiaoTongChengGongTongZhi,
  ShouDongLaQuYueJieLiShiShuJuQingQiuCanShu,
  ResultPoZhangDanZhuangTaiXinXidto,
  KaiPiaoTongZhiJieDuanShiTi,
  DangQianZhangDanShuJuHuiZongKaiPiaoShuJu,
  DangQianZhangDanShuJuHuiZongQingQiuCanShu,
  YueDuXiaJieDuanJiBenXinXi,
  ZhangDanMingXiXiaZaiQingQiuCanShu,
  InvoiceAllDownloadDto,
  PageDataYueDuZhangDanXiangQing,
  YueDuZhangDanMingXiZongLanQingQiuCanShu,
  YueDuZhangDanXiangQingZongLan,
  YueDuZhangDanMingXiQingQiuCanShu,
  PageDataJieDuanZhangDanXiangQing,
  JieDuanZhangDanMingXiZhangDanXiangQingFenYeQingQiuCanShu,
  XuQiuPiaoJuMingXiZongLan,
  JieDuanZhangDanMingXiQingQiuCanShu
} from './_interfaces.ts'

/** 账单单价/数量校验 */
export function invoiceInvoiceDataPullBillCheck(data: { month?: string; year?: string }): Promise<any> {
  return request.get('/api/invoice/invoiceDataPull/billCheck', data)
}

/** 数据清除 ----清除已付款数据-3 */
export function invoiceInvoiceDataPullDataClear(data: {
  // 图册信息
  files?: File[]
}): Promise<any> {
  return request.post('/api/invoice/invoiceDataPull/dataClear')
}

/** 数据处理 ----清除已付款数据-部分sku */
export function invoiceInvoiceDataPullDataClear2(data: {
  // 图册信息
  file?: File[]
}): Promise<any> {
  return request.post('/api/invoice/invoiceDataPull/dataClear2')
}

/** 拉取数据处理 ----2 */
export function invoiceInvoiceDataPullInvoiceDataHandle(data: { month?: number; year?: number }): Promise<any> {
  return request.get('/api/invoice/invoiceDataPull/invoiceDataHandle', data)
}

/** 金蝶数据获取中文描述 */
export function invoiceInvoiceDataPullJdDataSkuDesc(): Promise<any> {
  return request.post('/api/invoice/invoiceDataPull/jdDataSkuDesc')
}

/** 拉取po单和应付单数据----1 */
export function invoiceInvoiceDataPullPullInvoiceOrderData(data: { monthStr?: string }): Promise<any> {
  return request.post('/api/invoice/invoiceDataPull/pullInvoiceOrderData', data)
}

/** 更新账单表信息 */
export function invoiceInvoiceDataPullUpdateSummaryBill(data: { month?: string; year?: string }): Promise<any> {
  return request.post('/api/invoice/invoiceDataPull/updateSummaryBill', data)
}

/** sku开票品名查询 */
export function invoiceInvoiceManageGetPoSkuInfoPoNumber(data: {
  poNumber?: string
}): Promise<CaiGouDanCaiGouDanSKUKaiPiaoPinMingDto> {
  return request.post('/api/invoice/invoiceManage/getPoSkuInfo/${poNumber}')
}

/** 开票品名修改 */
export function invoiceInvoiceManageUpdateInvoiceName(data: CaiGouDanCaiGouDanSKUKaiPiaoPinMingDto): Promise<any> {
  return request.post('/api/invoice/invoiceManage/updateInvoiceName', data)
}

/** 确认账单 */
export function invoiceInvoiceManageApiConfirmPurchaseBill(data: ZhangDanQueRendto): Promise<ResultPostring> {
  return request.post('/api/invoice/invoiceManageApi/confirmPurchaseBill', data)
}

/** 删除月度账单数据 */
export function invoiceInvoiceManageApiDeleteMonthData(): Promise<any> {
  return request.post('/api/invoice/invoiceManageApi/deleteMonthData')
}

/** 开票成功提醒(阶段) */
export function invoiceInvoiceManageApiPeriodInvoiceSuccessNotice(data: KaiPiaoTongChengGongTongZhi): Promise<boolean> {
  return request.post('/api/invoice/invoiceManageApi/periodInvoiceSuccessNotice', data)
}

/** 手动拉取t-1历史数据(可按指定月) */
export function invoiceInvoiceManageApiPullPurchaseBillHisData(
  data: ShouDongLaQuYueJieLiShiShuJuQingQiuCanShu
): Promise<any> {
  return request.post('/api/invoice/invoiceManageApi/pullPurchaseBillHisData', data)
}

/** 开票通知推送接口(阶段) */
export function invoiceInvoiceManageApiPushPeriodInvoiceNotice(
  data: KaiPiaoTongZhiJieDuanShiTi
): Promise<ResultPoZhangDanZhuangTaiXinXidto> {
  return request.post('/api/invoice/invoiceManageApi/pushPeriodInvoiceNotice', data)
}

/** 开始拉取账单数据 */
export function invoiceInvoiceManageApiStartPullPurchaseBillData(): Promise<boolean> {
  return request.post('/api/invoice/invoiceManageApi/startPullPurchaseBillData')
}

/** 转换正式对账1.0数据 */
export function invoiceInvoiceManageApiTransferFormalData(): Promise<any> {
  return request.post('/api/invoice/invoiceManageApi/transferFormalData')
}

/** 当前账期数据汇总/开票 */
export function invoiceInvoiceReconDetailBillCurrentDataSummary(
  data: DangQianZhangDanShuJuHuiZongQingQiuCanShu
): Promise<DangQianZhangDanShuJuHuiZongKaiPiaoShuJu> {
  return request.post('/api/invoice/invoiceReconDetail/billCurrentDataSummary', data)
}

/** 月度下阶段基本信息 */
export function invoiceInvoiceReconDetailBillPeriodInfo(data?: any): Promise<YueDuXiaJieDuanJiBenXinXi> {
  return request.get('/api/invoice/invoiceReconDetail/billPeriodInfo', data)
}

/** 删除账单上传的开票文件 */
export function invoiceInvoiceReconDetailBillPeriodInvoiceDelete(data?: any): Promise<any> {
  return request.get('/api/invoice/invoiceReconDetail/billPeriodInvoiceDelete', data)
}

/** 阶段账单上传开票文件 */
export function invoiceInvoiceReconDetailBillPeriodInvoiceUpload(data?: any): Promise<any> {
  return request.post('/api/invoice/invoiceReconDetail/billPeriodInvoiceUpload', data)
}

/** 下载账单详情 */
export function invoiceInvoiceReconDetailInvoiceDetailDownload(data: ZhangDanMingXiXiaZaiQingQiuCanShu): Promise<any> {
  return request.post('/api/invoice/invoiceReconDetail/invoiceDetailDownload', data)
}

/** 下载月度下所有开票文件 */
export function invoiceInvoiceReconDetailInvoiceFileAllDownload(data: InvoiceAllDownloadDto): Promise<any> {
  return request.post('/api/invoice/invoiceReconDetail/invoiceFileAllDownload', data)
}

/** 月度账单详情分页 */
export function invoiceInvoiceReconDetailInvoiceMonthPage(
  data: YueDuZhangDanMingXiZongLanQingQiuCanShu
): Promise<PageDataYueDuZhangDanXiangQing> {
  return request.post('/api/invoice/invoiceReconDetail/invoiceMonthPage', data)
}

/** 月度账单明细总览 */
export function invoiceInvoiceReconDetailInvoiceMonthView(
  data: YueDuZhangDanMingXiQingQiuCanShu
): Promise<YueDuZhangDanXiangQingZongLan> {
  return request.post('/api/invoice/invoiceReconDetail/invoiceMonthView', data)
}

/** 阶段账单详情分页 */
export function invoiceInvoiceReconDetailInvoicePeriodPage(
  data: JieDuanZhangDanMingXiZhangDanXiangQingFenYeQingQiuCanShu
): Promise<PageDataJieDuanZhangDanXiangQing> {
  return request.post('/api/invoice/invoiceReconDetail/invoicePeriodPage', data)
}

/** 阶段账单明细总览 */
export function invoiceInvoiceReconDetailInvoicePeriodView(
  data: JieDuanZhangDanMingXiQingQiuCanShu
): Promise<XuQiuPiaoJuMingXiZongLan> {
  return request.post('/api/invoice/invoiceReconDetail/invoicePeriodView', data)
}

/** 账单确认/异议处理 */
export function invoiceInvoiceReconciliationBillConfirmOrProgress(data?: any): Promise<any> {
  return request.post('/api/invoice/invoiceReconciliation/billConfirmOrProgress', data)
}

/** 对账明细下载 */
export function invoiceInvoiceReconciliationBillDetailsDownload(data: { id?: string }): Promise<any> {
  return request.get('/api/invoice/invoiceReconciliation/billDetailsDownload', data)
}

/** 对账明细下载全部 */
export function invoiceInvoiceReconciliationBillDetailsDownloadAll(data: {
  month?: string
  year?: string
}): Promise<any> {
  return request.get('/api/invoice/invoiceReconciliation/billDetailsDownloadAll', data)
}

/** 账单快照备份 */
export function invoiceInvoiceReconciliationBillSnapshotBak(data: { monthIdStr?: string }): Promise<any> {
  return request.get('/api/invoice/invoiceReconciliation/billSnapshotBak', data)
}

/** 查询固定年份月度账单信息 */
export function invoiceInvoiceReconciliationGetMonthSummaryInfo(data: { year?: number }): Promise<any> {
  return request.post('/api/invoice/invoiceReconciliation/getMonthSummaryInfo', data)
}
